package com.srlg.webflux.service.impl;

import org.springframework.stereotype.Service;

import com.srlg.webflux.dao.AuthorDao;
import com.srlg.webflux.entity.Author;
import com.srlg.webflux.service.AuthorService;

import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
 * 作者服务实现
 * @author srlg li
 */
@Service
@RequiredArgsConstructor
public class AuthorServiceImpl implements AuthorService {

    private final AuthorDao authorDao;

    @Override
    public Flux<Author> getAllAuthor() {

        Flux<Author> authors = authorDao.findAll();

        return authors;
    }

    @Override
    public Mono<Author> findAuthorById(Long id) {
        Mono<Author> author = authorDao.findById(id);
        return author;
    }
}
